Skip to content

feat(tonic-xds): grpc channel builder#2584

Merged
YutaoMa merged 7 commits into
hyperium:masterfrom
YutaoMa:yutaoma/xds-builder
Apr 10, 2026
Merged

feat(tonic-xds): grpc channel builder#2584
YutaoMa merged 7 commits into
hyperium:masterfrom
YutaoMa:yutaoma/xds-builder

Conversation

@YutaoMa
Copy link
Copy Markdown
Collaborator

@YutaoMa YutaoMa commented Apr 7, 2026

Motivation

Ref: #2444

Last PR to complete A27 gRFC support for basic xDS service discovery: wire all xDS components into XdsChannelBuilder.

Solution

Key design decisions looking for in-depth reviews:

  1. One xDS client per channel: each channel now creates its own XdsClient with its own ADS connection. Other gRPC implementation like grpc-go uses a singleton shared across channels. The plan is to switch to, or at least provide an option for, the same singleton pattern, but in a later PR.
  2. Default retry policy: currently the channel builder does not expose API to configure the retry policy and always use the default values. Didn't include it in this PR because it's not part of the xDS spec, but worth discussing how will we plan to support it in future PRs.

Testing

Aside from UTs, added example runnables that serve as a local integration test:

% ./tonic-xds/examples/run_xds_example.sh

[xds] xDS server listening on 0.0.0.0:18000
[xds]   listener: my-service
[xds]   cluster:  my-cluster
[xds]   endpoints: 127.0.0.1:50051
[greeter] Greeter server listening on 0.0.0.0:50051
[client] Building xDS channel for target: xds:///my-service
[client] Channel built. Sending requests (Ctrl-C to stop)...
[client]
[xds]   -> envoy.config.listener.v3.Listener: 1 resource(s)
[xds]   -> envoy.config.cluster.v3.Cluster: 1 resource(s)
[xds]   -> envoy.config.endpoint.v3.ClusterLoadAssignment: 1 resource(s)
[greeter] Received request: name=request-1
[client] [1] Response: Hello request-1 from 0.0.0.0:50051
[greeter] Received request: name=request-2
[client] [2] Response: Hello request-2 from 0.0.0.0:50051
[greeter] Received request: name=request-3
[client] [3] Response: Hello request-3 from 0.0.0.0:50051

@YutaoMa YutaoMa changed the title Yutaoma/xds builder feat(tonic-xds): grpc channel builder Apr 7, 2026
@YutaoMa YutaoMa marked this pull request as ready for review April 7, 2026 23:37
@gu0keno0 gu0keno0 self-requested a review April 8, 2026 13:43
Comment thread tonic-xds/examples/channel.rs Outdated
Comment thread tonic-xds/examples/channel.rs Outdated
Comment thread tonic-xds/examples/channel.rs Outdated
Comment thread tonic-xds/src/lib.rs
Comment thread tonic-xds/src/lib.rs
Comment thread tonic-xds/src/xds/bootstrap.rs
Comment thread tonic-xds/src/xds/cluster_discovery.rs
Comment thread tonic-xds/src/client/channel.rs
Comment thread tonic-xds/src/client/channel.rs
Comment thread tonic-xds/src/client/channel.rs Outdated
Copy link
Copy Markdown
Collaborator

@gu0keno0 gu0keno0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall

Comment thread tonic-xds/examples/xds_server.rs
@YutaoMa YutaoMa merged commit 5fe2c40 into hyperium:master Apr 10, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants